// src/components/QuestionEditor/RatingInput.jsx
import React from 'react';
import { Slider, InputNumber, Space } from 'antd';

const RatingInput = ({ question, updateQuestion }) => {
  
  //更新用户输入评分题的最高评分
  const handleChange = (value) => {
    updateQuestion({ ...question, max: value });
  };

  return (
    <Space direction="vertical" style={{ width: '100%' }}>
      <div>评分范围：1 到 {question.max} 分</div>
      <Space>
        <span>最大分值：</span>
        <InputNumber
          min={2}
          max={10}
          value={question.max}
          onChange={handleChange}
        />
      </Space>
      <Slider
        min={1}
        max={question.max}
        range
        disabled
        defaultValue={[1, question.max]}
      />
    </Space>
  );
};

export default RatingInput;